package com.keyue.isolate.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;


@Getter
@AllArgsConstructor
public enum DataPermissionFieldEnum {

    SOURCE_PLATFORM("sourcePlatform", "来源平台"),
    WAREHOUSE_CODE("warehouseCode", "仓库编码"),
    COMPANY_CODE("companyCode", "承运商公司编码"),
    CARRIER_CODE("carrierCode", "承运商编码"),
    TRANSPORT_TYPE_CODE("transportTypeCode", "承运类型"),
    SUB_TRANSPORT_TYPE_CODE("subTransportTypeCode", "承运子类型"),
    CUSTOMER("customer", "下单客户"),
    CONTRACT_BODY("contractBody", "合同主体"),
    ;

    private String field;

    private String fieldName;

    public static String getFieldNameBy(String field) {
        for (DataPermissionFieldEnum fieldEnum : DataPermissionFieldEnum.values()) {
            if (fieldEnum.getField().equals(field)) {
                return fieldEnum.getFieldName();
            }
        }
        return null;
    }


    /**
     * 企业订单
     *
     * @return
     */
    public static List<String> getOrderQY() {
        return Arrays.asList(SOURCE_PLATFORM.getField(), WAREHOUSE_CODE.getField(), CARRIER_CODE.getField(), CUSTOMER.getField());
    }

    /**
     * 零售订单
     *
     * @return
     */
    public static List<String> getOrderLS() {
        return Arrays.asList(SOURCE_PLATFORM.getField(), WAREHOUSE_CODE.getField(), CARRIER_CODE.getField());
    }

    /**
     * 线下计划
     *
     * @return
     */
    public static List<String> getOrderXXPlan() {
        return Arrays.asList(SOURCE_PLATFORM.getField(), WAREHOUSE_CODE.getField(), CARRIER_CODE.getField(), CUSTOMER.getField());
    }

    /**
     * 线下订单
     *
     * @return
     */
    public static List<String> getOrderXX() {
        return Arrays.asList(SOURCE_PLATFORM.getField(), WAREHOUSE_CODE.getField(), CARRIER_CODE.getField(), CUSTOMER.getField());
    }

    /**
     * 待匹配订单
     *
     * @return
     */
    public static List<String> getOrderWaitMatch() {
        return Arrays.asList(SOURCE_PLATFORM.getField(), WAREHOUSE_CODE.getField());
    }

    /**
     * 事故跟踪单
     *
     * @return
     */
    public static List<String> getOrderSG() {
        return Arrays.asList(SOURCE_PLATFORM.getField());
    }


    /**
     * 外部订单
     *
     * @return
     */
    public static List<String> getOrderOut() {
        return Arrays.asList(CUSTOMER.getField());
    }

    /**
     * 外部订单
     *
     * @return
     */
    public static List<String> getOrderExport() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }


    /**
     * 收货凭证
     *
     * @return
     */
    public static List<String> getFinanceSH() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }


    /**
     * 成品库承运商运价表
     *
     * @return
     */
    public static List<String> getFinanceCPKPrice() {
        return Arrays.asList(WAREHOUSE_CODE.getField(), COMPANY_CODE.getField(), TRANSPORT_TYPE_CODE.getField(), SUB_TRANSPORT_TYPE_CODE.getField(), CONTRACT_BODY.getField());
    }

    /**
     * 成品库承运商对账单
     *
     * @return
     */
    public static List<String> getFinanceCPKBill() {
        return Arrays.asList(WAREHOUSE_CODE.getField(), COMPANY_CODE.getField(), TRANSPORT_TYPE_CODE.getField(), SUB_TRANSPORT_TYPE_CODE.getField());
    }

    /**
     * 明睿达承运商运价表
     *
     * @return
     */
    public static List<String> getFinanceMRDPrice() {
        return Arrays.asList(WAREHOUSE_CODE.getField(), COMPANY_CODE.getField(), TRANSPORT_TYPE_CODE.getField(), SUB_TRANSPORT_TYPE_CODE.getField());
    }

    /**
     * 明睿达承运商对账单
     *
     * @return
     */
    public static List<String> getFinanceMRDBill() {
        return Arrays.asList(WAREHOUSE_CODE.getField(), COMPANY_CODE.getField(), TRANSPORT_TYPE_CODE.getField(), SUB_TRANSPORT_TYPE_CODE.getField());
    }

    /**
     * 出入库数据
     *
     * @return
     */
    public static List<String> getFinanceInOut() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }

    /**
     * 装卸货价格
     *
     * @return
     */
    public static List<String> getFinanceZXPrice() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }

    /**
     * 装卸货凭证
     *
     * @return
     */
    public static List<String> getFinanceZXPZ() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }

    /**
     * 装卸费账单
     *
     * @return
     */
    public static List<String> getFinanceZXBill() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }

    /**
     * 业务伙伴
     *
     * @return
     */
    public static List<String> getBusiness() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }

    /**
     * 装卸货补贴
     *
     * @return
     */
    public static List<String> getFinanceZXBT() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }

    /**
     * TMS运输平台
     *
     * @return
     */
    public static List<String> getTransportPlat() {
        return Arrays.asList(CARRIER_CODE.getField());
    }

    /**
     * 客户管理
     *
     * @return
     */
    public static List<String> getCustomer() {
        return Arrays.asList(CUSTOMER.getField());
    }

    public static List<String> getAllView() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }

    public static List<String> getAllGxView() {
        return Arrays.asList(WAREHOUSE_CODE.getField());
    }
}
